/*
 * Copyright 2009 XueSong Guo.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cn.webwheel.database.test;

import cn.webwheel.database.SqlObject;
import cn.webwheel.database.annotations.Include;
import cn.webwheel.database.annotations.Select;
import cn.webwheel.database.annotations.Update;
import cn.webwheel.database.annotations.UserType;
import cn.webwheel.database.types.AsciiStream;
import cn.webwheel.database.types.BinaryStream;
import cn.webwheel.database.types.CharacterStream;

import java.math.BigDecimal;
import java.net.URL;
import java.sql.*;
import java.util.List;

abstract public class FullType {
    private Array arrayi;
    private AsciiStream asciiStreami;
    private BigDecimal bigDecimali;
    private BinaryStream binaryStreami;
    private Blob blobi;
    private boolean booleani;
    private Boolean booleanw;
    private byte bytei;
    private Byte bytew;
    private byte[] bytesi;
    private CharacterStream characterStreami;
    private Clob clobi;
    private Date datei;
    private double doublei;
    private Double doublew;
    private float floati;
    private Float floatw;
    private int inti;
    private Integer intw;
    private long longi;
    private Long longw;
    private SqlObject objecti;
    private Ref refi;
    private short shorti;
    private Short shortw;
    private String stringi;
    private Time timei;
    private Timestamp timestampi;
    private URL urli;

    private StringBuilder sb;
    private StringBuffer sb2;

    public Array getArrayi() {
        return arrayi;
    }

    public void setArrayi(Array arrayi) {
        this.arrayi = arrayi;
    }

    public AsciiStream getAsciiStreami() {
        return asciiStreami;
    }

    public void setAsciiStreami(AsciiStream asciiStreami) {
        this.asciiStreami = asciiStreami;
    }

    public BigDecimal getBigDecimali() {
        return bigDecimali;
    }

    public void setBigDecimali(BigDecimal bigDecimali) {
        this.bigDecimali = bigDecimali;
    }

    public BinaryStream getBinaryStreami() {
        return binaryStreami;
    }

    public void setBinaryStreami(BinaryStream binaryStreami) {
        this.binaryStreami = binaryStreami;
    }

    public Blob getBlobi() {
        return blobi;
    }

    public void setBlobi(Blob blobi) {
        this.blobi = blobi;
    }

    public boolean isBooleani() {
        return booleani;
    }

    public void setBooleani(boolean booleani) {
        this.booleani = booleani;
    }

    public Boolean getBooleanw() {
        return booleanw;
    }

    public void setBooleanw(Boolean booleanw) {
        this.booleanw = booleanw;
    }

    public byte getBytei() {
        return bytei;
    }

    public void setBytei(byte bytei) {
        this.bytei = bytei;
    }

    public Byte getBytew() {
        return bytew;
    }

    public void setBytew(Byte bytew) {
        this.bytew = bytew;
    }

    public byte[] getBytesi() {
        return bytesi;
    }

    public void setBytesi(byte[] bytesi) {
        this.bytesi = bytesi;
    }

    public CharacterStream getCharacterStreami() {
        return characterStreami;
    }

    public void setCharacterStreami(CharacterStream characterStreami) {
        this.characterStreami = characterStreami;
    }

    public Clob getClobi() {
        return clobi;
    }

    public void setClobi(Clob clobi) {
        this.clobi = clobi;
    }

    public Date getDatei() {
        return datei;
    }

    public void setDatei(Date datei) {
        this.datei = datei;
    }

    public double getDoublei() {
        return doublei;
    }

    public void setDoublei(double doublei) {
        this.doublei = doublei;
    }

    public Double getDoublew() {
        return doublew;
    }

    public void setDoublew(Double doublew) {
        this.doublew = doublew;
    }

    public float getFloati() {
        return floati;
    }

    public void setFloati(float floati) {
        this.floati = floati;
    }

    public Float getFloatw() {
        return floatw;
    }

    public void setFloatw(Float floatw) {
        this.floatw = floatw;
    }

    public int getInti() {
        return inti;
    }

    public void setInti(int inti) {
        this.inti = inti;
    }

    public Integer getIntw() {
        return intw;
    }

    public void setIntw(Integer intw) {
        this.intw = intw;
    }

    public long getLongi() {
        return longi;
    }

    public void setLongi(long longi) {
        this.longi = longi;
    }

    public Long getLongw() {
        return longw;
    }

    public void setLongw(Long longw) {
        this.longw = longw;
    }

    public SqlObject getObjecti() {
        return objecti;
    }

    @Include(true)
    public void setObjecti(SqlObject objecti) {
        this.objecti = objecti;
    }

    public Ref getRefi() {
        return refi;
    }

    public void setRefi(Ref refi) {
        this.refi = refi;
    }

    public short getShorti() {
        return shorti;
    }

    public void setShorti(short shorti) {
        this.shorti = shorti;
    }

    public Short getShortw() {
        return shortw;
    }

    public void setShortw(Short shortw) {
        this.shortw = shortw;
    }

    public String getStringi() {
        return stringi;
    }

    public void setStringi(String stringi) {
        this.stringi = stringi;
    }

    public Time getTimei() {
        return timei;
    }

    public void setTimei(Time timei) {
        this.timei = timei;
    }

    public Timestamp getTimestampi() {
        return timestampi;
    }

    public void setTimestampi(Timestamp timestampi) {
        this.timestampi = timestampi;
    }

    public URL getUrli() {
        return urli;
    }

    public void setUrli(URL urli) {
        this.urli = urli;
    }

    public StringBuilder getSb() {
        return sb;
    }

    public void setSb(StringBuilder sb) {
        this.sb = sb;
    }

    public StringBuffer getSb2() {
        return sb2;
    }

    @UserType("sb2ut")
    public void setSb2(StringBuffer sb2) {
        this.sb2 = sb2;
    }

    //full:    @Update("insert into fulltype values(#arrayi#,#asciiStreami#,#bigDecimali#,#binaryStreami#,#blobi#,#booleani#,#booleanw#,#bytei#,#bytew#,#bytesi#,#characterStreami#,#clobi#,#datei#,#doublei#,#doublew#,#floati#,#floatw#,#inti#,#intw#,#longi#,#longw#,#objecti#,#refi#,#shorti#,#shortw#,#stringi#,#timei#,#timestampi#,#urli#)")
    //h2
    @Update("insert into fulltype(asciiStreami,bigDecimali,binaryStreami,blobi,booleani,booleanw,bytei,bytew,bytesi,characterStreami,clobi,datei,doublei,doublew,floati,floatw,inti,intw,longi,longw,objecti,shorti,shortw,stringi,timei,timestampi,sb,sb2)" +
            " values(#this.asciiStreami#,#this.bigDecimali#,#this.binaryStreami#,#this.blobi#,#this.booleani#,#this.booleanw#,#this.bytei#,#this.bytew#,#this.bytesi#,#this.characterStreami#,#this.clobi#,#this.datei#,#this.doublei#,#this.doublew#,#this.floati#,#this.floatw#,#this.inti#,#this.intw#,#this.longi#,#this.longw#,#this.objecti#,#this.shorti#,#this.shortw#,#this.stringi#,#this.timei#,#this.timestampi#,#this.sb:sbut#,#this.sb2:sb2ut#)")
    abstract public void insert() throws Exception;

    @Select(value = "select * from fulltype",
    result = "-arrayi -refi -urli +asciiStreami +binaryStreami +blobi +bytesi +characterStreami +clobi +sb:sb:sbut")
    abstract public List<FullType> getAll() throws Exception;
}
